package com.uzai.console.web.pyq;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSort;
import com.uzai.console.dto.pyq.llygoods.PyqLlyGoodsJobBatchSendDao;
import com.uzai.console.dto.pyq.llygoods.PyqLlyGoodsJobSendDao;
import com.uzai.console.dto.pyq.llygoods.PyqLlyGoodsQuery;
import com.uzai.console.service.feign.UzaiBusinessFeignService;
import com.uzai.console.service.lly.LlyGoodsService;
import com.uzai.console.service.pyq.PyqLlyGoodsService;
import com.uzai.console.vo.pyq.llygoods.PyqLlyGoodsVo;
import com.uzai.console.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * 朋友圈老林云商品列表
 * @author liuqi
 * @date 2021年08月16日 15:11
 */
@Api(value = "悠哉精选(淘宝)商品列表",tags = "个人微信|朋友圈|悠哉精选(淘宝)商品列表")
@ApiSort(31)
@RestController
public class PyqLlyGoodsController extends BaseController {
    private Logger logger = LoggerFactory.getLogger(PyqLlyGoodsController.class);

    @Autowired
    private PyqLlyGoodsService pyqLlyGoodsService;
    @Autowired
    private LlyGoodsService llyGoodsService;
    @Autowired
    private UzaiBusinessFeignService uzaiBusinessFeignService;

    @ApiOperation(value = "分页查询悠哉精选(淘宝)商品列表", notes = "分页查询悠哉精选(淘宝)商品列表", response = PyqLlyGoodsVo.class)
    @ApiOperationSupport(order = 1)
    @PostMapping("/pyqLlyGoods/findPyqLlyGoodsList")
    public Object findPyqLlyGoodsList(@RequestBody PyqLlyGoodsQuery pyqLlyGoodsQuery){
        //pyqLlyGoodsQuery.setSize(40);//默认查询40条
        pyqLlyGoodsQuery.setPlatform(0); //悠哉精选淘宝商品
        return pyqLlyGoodsService.findPyqLlyGoodsList(pyqLlyGoodsQuery);
    }

    @ApiOperation(value = "批量发送悠哉精选(淘宝)商品朋友圈任务", notes = "批量发送悠哉精选(淘宝)商品朋友圈任务")
    @ApiOperationSupport(order = 2)
    @PostMapping("/pyqLlyGoods/batchSendPyqJpb")
    public Object batchSendPyqJpb(@RequestBody PyqLlyGoodsJobBatchSendDao pyqLlyGoodsJobBatchSendDao){
        pyqLlyGoodsJobBatchSendDao.setPlatform(0); //后台平台淘宝平台
        pyqLlyGoodsJobBatchSendDao.setType(2); //悠哉精品库淘宝商品
         pyqLlyGoodsService.batchSendPyqJpb(pyqLlyGoodsJobBatchSendDao);
        return true;
    }

    @ApiOperation(value = "单个悠哉精选(淘宝)商品发送朋友圈任务", notes = "单个悠哉精选(淘宝)商品发送朋友圈任务")
    @ApiOperationSupport(order = 3)
    @PostMapping("/pyqLlyGoods/sendPyqJpb")
    public Object sendPyqJpb(@RequestBody PyqLlyGoodsJobSendDao pyqLlyGoodsJobSendDao){
        pyqLlyGoodsJobSendDao.setPlatform(0); //后台平台淘宝平台
        pyqLlyGoodsJobSendDao.setType(2); //悠哉精品库淘宝商品
        pyqLlyGoodsService.sendPyqJpb(pyqLlyGoodsJobSendDao);
        return true;
    }

    @ApiOperation(value = "更新老林云最新商品", notes = "更新老林云最新商品")
    @ApiOperationSupport(order = 4)
    @PostMapping("/pyqLlyGoods/downLoadLlyGoodsSync")
    public Object downLoadLlyGoodsSync(){
        llyGoodsService.downLoadLlyGoodsSync();
        return true;
    }

}
